/**
 * 
 */
package com.edocbase.desktop.web.actions;

import java.text.DateFormat;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.time.DateFormatUtils;

import com.edocbase.biz.diary.entities.DiaryEntity;
import com.edocbase.biz.diary.entities.DiaryStatisticManager;
import com.edocbase.biz.util.LunarCalendarUtils;
import com.edocbase.desktopserver.WebActionHandler;
import com.edocbase.desktopserver.annotations.Action;
import com.edocbase.desktopserver.annotations.View;
import com.edocbase.entity.EntityManager;
import com.edocbase.entity.EntityManagerFactory;

/**
 * @author lifei114@gmail.com
 *
 */
@Action("index")
public class IndexAction extends WebActionHandler {

	@View(type = "freemarker")
	public String home(){
		DiaryStatisticManager statManager = DiaryStatisticManager.getManager();
		assign("total",statManager.getTotal());
		assign("totalMailed",statManager.getTotalMailed());
		assign("totalNoMailed",statManager.getTotalNoMailed());
		assign("driverCount",statManager.getMDriverNum());
		assign("accountList",statManager.getAccountList());
		
		assign("weekDay",LunarCalendarUtils.day(new Date()));
		
		List<DiaryEntity> diaryList = statManager.getRecentDiaries();
		assign("diaryList",diaryList);
		
		return "/home.ftl";
	}
}
